<!DOCTYPE html>
<html lang="zh">
<head>
  <meta http-equiv="Cache-Control" content="no-transform"/>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>trackersAria2</title>
  <meta name="keywords" content="aria2_tkser,aria2列表转换,arir2_bt-tracker,aria2BT服务器,aria2_trackers"/>
  <meta name="description"
        content="The BT server address (bt-tracker) of aria2's character processing based on the aria2 feature saves the trouble of using Excel processing,aria2的BT服务器地址(bt-tracker)根据aria2特性做的字符处理省去了用excel处理的麻烦。"/>
</head>
<style>
  * {
    font-family: "微软雅黑";
  }

  body {
    background: #fff;
  }

  input {
    cursor: pointer;
  }

  .ti {
    margin: 0;
    padding: 20px 0;
    line-height: 30px;
    color: #333;
  }

  .ti a {
    color: #255359;
  }

  #trackertext {
    display: block;
    margin: 0 auto;
    background: #255359;
    word-wrap: break-word;
    padding: 15px;
    color: #fff;
    border-radius: 2px;
  }

  .mantop {
    text-align: center;
    background-color: #fff;
    height: 30px;
    line-height: 30px;
    color: #255359;
    font-weight: 500;
    border-bottom: 1px solid rgba(0, 0, 0, 0.22);
    padding: 5px 0;
  }

  .mantop h1 {
    display: inline;
    font-size: 20px;
  }

  .mantop a {
    color: #255359;
    text-decoration: none;
  }

  .wordback {
    width: 100%;
    height: 100%;
    text-align: center;
    background-repeat: repeat-x;
  }

  .tab {
    width: 350px;
    margin: 5px auto;
    background: #33A6B8;
    position: relative;
    padding: 5px 15px;
    color: #fff;
    text-align: left;
  }

  .tab > input {
    position: absolute;
    right: 0;
    margin-top: -2px;
    margin-right: 3px;
    background: #0089A7;
    width: 80px;
    color: #fff;
    height: 25px;
    border: none;
    outline: none;
  }

  .tab > input:active {
    background: #255359;
  }

  #bucopy {
    margin-top: 20px;
    width: 120px;
    height: 35px;
    background: #6A4C9C;
    color: #fff;
    border: none;
    outline: none;
  }

  #bucopy:active {
    background: #562E37
  }

  #trackercopy {
    width: 0;
    height: 0;
    position: absolute;
    opacity: 0;
    filter: alpha(opacity=0);
  }

  .man_tk_text {
    position: relative;
    width: 80%;
    margin: 5px auto;
  }

  #icos {
    width: 30px;
    opacity: 0;
    height: 30px;
    color: #fff;
    background: #6A4C9C;
    z-index: 100;
    display: block;
    position: absolute;
    right: -12px;
    top: -12px;
    border-radius: 30px;
    font-style: inherit;
    line-height: 30px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
  }
</style>
<body>
<div class="mantop">
  <h1><a href="http://www.tkser.tk/">aria2-BT服务器地址</a></h1></div>
<div class="wordback">
  <p class="ti">trackers列表来至
    <a title="github-trackers" href="https://github.com/ngosang/trackerslist" rel="nofollow">github</a>
    <br>以下只是对aria2的BT服务器地址(bt-tracker)做的快捷复制
    <br>根据aria2特性做的字符处理省去了用excel处理的麻烦。
    <br>此列表不一定保证有速度，没速度可以试试改下监听端口。</p>
  <div class="tab">
    <span>trackers_best (推荐)</span>
    <input type="button"
           onclick="loadXMLDoc('https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt')"
           value="获取并生成"/></div>
  <div class="tab">
    <span>trackers_all</span>
    <input type="button"
           onclick="loadXMLDoc('https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt')"
           value="获取并生成"/></div>
  <div class="tab">
    <span>trackers_all_udp</span>
    <input type="button"
           onclick="loadXMLDoc('https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all_udp.txt')"
           value="获取并生成"/></div>
  <div class="tab">
    <span>trackers_all_http</span>
    <input type="button"
           onclick="loadXMLDoc('https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all_http.txt')"
           value="获取并生成"/></div>
  <div class="tab">
    <span>trackers_all_https</span>
    <input type="button"
           onclick="loadXMLDoc('https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all_https.txt')"
           value="获取并生成"/></div>
  <div class="tab">
    <span>trackers_all_ws</span>
    <input type="button"
           onclick="loadXMLDoc('https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all_ws.txt')"
           value="获取并生成"/></div>
  <p style="color:#333;">当DNS出问题后可以使用以下这些转换成IP的trackers</p>
  <div class="tab">
    <span>trackers_best_ip (理论上比域名的快)</span>
    <input type="button"
           onclick="loadXMLDoc('https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best_ip.txt')"
           value="获取并生成"/></div>
  <div class="tab">
    <span>trackers_all_ip</span>
    <input type="button"
           onclick="loadXMLDoc('https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all_ip.txt')"
           value="获取并生成"/></div>
  <input type="button" id="bucopy" onclick="copyUrl2()" value="点击复制"/>
  <div class="man_tk_text">
    <i id="icos">0</i>
    <p id="trackertext">trackerslist生成的位置</p>
  </div>
  <textarea id="trackercopy"></textarea>
</div>
</body>
<script>
  var xmlhttp;
  var trackertext = document.getElementById("trackertext");
  var icos = document.getElementById("icos");

  function loadXMLDoc(url) {
    xmlhttp = null;
    if (window.XMLHttpRequest) { // code for Firefox, Opera, IE7, etc.
      xmlhttp = new XMLHttpRequest();
    } else if (window.ActiveXObject) { // code for IE6, IE5
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (xmlhttp != null) {
      xmlhttp.onreadystatechange = state_Change;
      xmlhttp.open("GET", url, true);
      xmlhttp.send(null);
    } else {
      alert("Your browser does not support XMLHTTP.");
    }
  }

  function state_Change() {
    if (xmlhttp.readyState == 4) { // 4 = "loaded"
      if (xmlhttp.status == 200) { // 200 = "OK"
        var ch = "announce";
        var reg = "/" + ch + "/g";
        var ckok = "announce,";
        var aria2text = xmlhttp.responseText;
        var teix = aria2text.split(ch),
          aria2text = aria2text.replace(/\s/g, "");
        var aria2text_ok = aria2text.replace(eval(reg), ckok);
        aria2text_ok = aria2text_ok.substring(0, aria2text_ok.length - 1);
        trackertext.innerHTML = aria2text_ok;
        if (icos.innerText === "0") {
          icos.innerText = teix.length - 1;
          fadeIn(icos);
        } else {
          icos.innerText = teix.length - 1;
        }

      } else {
        trackertext.innerHTML = "Github源站点访问出错";
      }
    }
  }

  function copyUrl2() {
    var trackercopy = document.getElementById("trackercopy");
    trackertext = document.getElementById("trackertext");
    var bucopy = document.getElementById("bucopy");
    trackercopy.value = trackertext.innerText;
    console.log(trackercopy.value)
    trackercopy.select();
    document.execCommand("Copy", "false", null);
    bucopy.value = '已复制好，可贴粘';
    setTimeout(function () {
        bucopy.value = '点击复制'
      },
      3000);
  }

  function fadeIn(el) {
    el.style.opacity = 0;
    el.style.display = "";

    var last = +new Date();
    var tick = function () {
      el.style.opacity = +el.style.opacity + (new Date() - last) / 800;
      last = +new Date();
      if (+el.style.opacity < 1) {
        (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);
      }
    };
    tick();
  }
</script>
</html>
